//
//  YCMineResultsTableViewCell.m
//  YCVillageDoctor
//
//  Created by zhangxiaoliang on 2017/6/7.
//  Copyright © 2017年 zhangxiaoliang. All rights reserved.
//

#import "YCMineResultsTableViewCell.h"
@interface YCMineResultsTableViewCell()
@property(nonatomic,strong) UIImageView *imageIcon;
@property(nonatomic,strong) UILabel *labelText;
@property(nonatomic,strong)UIImageView *imageArrow;

@property(nonatomic,strong)UILabel *moneyLabel;

@property(nonatomic,strong)UILabel *directlyLabelBottom;
@property(nonatomic,strong)UILabel *indirectLabelBottom;
@end
@implementation YCMineResultsTableViewCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        //分割线
        UIView *lineView1 = [[UIView alloc]init];
        lineView1.backgroundColor = RGB(230, 230, 230);
        [self.contentView addSubview:lineView1];
        
        //分割线
        UIView *lineView2 = [[UIView alloc]init];
        lineView2.backgroundColor = RGB(230, 230, 230);
        [self.contentView addSubview:lineView2];

        
        
        UILabel *moneyLabel = [[UILabel alloc]init];
        self.moneyLabel = moneyLabel;
       // moneyLabel.backgroundColor = [UIColor redColor];
        moneyLabel.text = @"0元";
        moneyLabel.textAlignment = NSTextAlignmentCenter;
        moneyLabel.textColor = RGB(71, 71, 71);
        moneyLabel.font = [UIFont fontWithName:kFontLite size:16];
        [self.contentView addSubview:moneyLabel];
        
        UILabel *labelText = [[UILabel alloc]init];
        self.labelText = labelText;
        labelText.text = @"我的业绩";
        labelText.textColor = RGB(71, 71, 71);
        labelText.textAlignment = NSTextAlignmentCenter;
        labelText.font = [UIFont fontWithName:kFontLite size:16];
        [self.contentView addSubview:labelText];
     
        
        
        //直接销售
        
        UILabel *directlyLabelBottom = [[UILabel alloc]init];
        self.directlyLabelBottom = directlyLabelBottom;
        directlyLabelBottom.text = @"0张";
        directlyLabelBottom.textAlignment = NSTextAlignmentCenter;
        directlyLabelBottom.textColor = RGB(71, 71, 71);
        directlyLabelBottom.font = [UIFont fontWithName:kFontLite size:16];
        [self.contentView addSubview:directlyLabelBottom];
        
        UILabel *directlyLabelTop = [[UILabel alloc]init];
        directlyLabelTop.text = @"直接销售";
        directlyLabelTop.textAlignment = NSTextAlignmentCenter;
        directlyLabelTop.textColor = RGB(71, 71, 71);
        directlyLabelTop.font = [UIFont fontWithName:kFontLite size:16];
        [self.contentView addSubview:directlyLabelTop];
        
       
        
        
        //间接销售
        UILabel *indirectLabelBottom = [[UILabel alloc]init];
        self.indirectLabelBottom = indirectLabelBottom;
        indirectLabelBottom.text = @"0张";
        indirectLabelBottom.font = [UIFont fontWithName:kFontLite size:16];
        indirectLabelBottom.textColor = RGB(71, 71, 71);
        indirectLabelBottom.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:indirectLabelBottom];
        

        
        UILabel *indirectLabelTop = [[UILabel alloc]init];
        indirectLabelTop.text = @"间接销售";
        indirectLabelTop.textAlignment = NSTextAlignmentCenter;
        indirectLabelTop.textColor = RGB(71, 71, 71);
        indirectLabelTop.font = [UIFont fontWithName:kFontLite size:16];
        [self.contentView addSubview:indirectLabelTop];
        
        
        //底部线条
        UIView *lineView3 = [[UIView alloc]init];
        lineView3.backgroundColor = RGB(230, 230, 230);
        [self.contentView addSubview:lineView3];
        
        
        //布局
        __weak __typeof(&*self)mySelf = self;
        
        //第一线条距离
        CGFloat maginleft  = SCREEN_WIDTH/3;
        
        
        //第一条线
         [lineView1 mas_makeConstraints:^(MASConstraintMaker *make) {
             make.top.mas_equalTo(mySelf).mas_offset(20);
             make.left.mas_equalTo(mySelf).mas_offset(maginleft);
             make.width.mas_equalTo(1);
             make.height.mas_equalTo(40);
         }];
        
           //第二条线
        [lineView2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(mySelf).mas_offset(20);
            make.left.mas_equalTo(mySelf).mas_offset(maginleft*2);
            make.width.mas_equalTo(1);
            make.height.mas_equalTo(40);
        }];
        

       
        //我的业绩
        [moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(mySelf).mas_offset(20);
            make.left.mas_equalTo(mySelf).mas_equalTo(10);
            make.width.mas_equalTo(maginleft -20);
            make.height.mas_equalTo(20);
        }];
        
        [labelText mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(moneyLabel.mas_bottom).mas_offset(4);
            make.left.mas_equalTo(mySelf).mas_equalTo(10);
            make.width.mas_equalTo(maginleft -20);
            make.height.mas_equalTo(20);
        }];
        
        
        //直接销售
        [directlyLabelBottom mas_makeConstraints:^(MASConstraintMaker *make) {
                    make.top.mas_equalTo(mySelf).mas_offset(20);
                    make.centerX.mas_equalTo(mySelf.contentView.mas_centerX);
                    make.width.mas_equalTo(maginleft -20);
                    make.height.mas_equalTo(20);
        }];

        
        [directlyLabelTop mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(directlyLabelBottom.mas_bottom).mas_offset(4);
            make.centerX.mas_equalTo(mySelf.contentView.mas_centerX);
            make.width.mas_equalTo(maginleft -20);
            make.height.mas_equalTo(20);
        }];
        
        
        //间接销售
        
        [indirectLabelBottom mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(mySelf).mas_offset(20);
            make.right.mas_equalTo(mySelf.contentView.mas_right);
            make.width.mas_equalTo(maginleft-20);
            make.height.mas_equalTo(20);
        }];

        

        [indirectLabelTop mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(indirectLabelBottom.mas_bottom).mas_offset(4);
            make.right.mas_equalTo(mySelf.contentView.mas_right);
            make.width.mas_equalTo(maginleft -20);
            make.height.mas_equalTo(20);
        }];
    
        
        //底部线条
        
         [lineView3 mas_makeConstraints:^(MASConstraintMaker *make) {
             make.left.mas_equalTo(mySelf);
             make.right.mas_equalTo(mySelf);
             make.bottom.mas_equalTo(mySelf);
             make.height.mas_equalTo(10);
            
         }];
        
        
        
        
    }
    return self;
}
- (void)setModel:(YCInComeModel *)model
{
    _model = model;
    
    self.moneyLabel.text = [NSString stringWithFormat:@"%@元",model.sale_total_money];
    self.directlyLabelBottom.text =  [NSString stringWithFormat:@"%@张",model.on_sale_num];
    self.indirectLabelBottom.text = [NSString stringWithFormat:@"%@张",model.tow_sale_num];
    
    
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
